import { defineStore } from 'pinia';

export const allInfoStore = defineStore('allInfo', {
    state: () => ({
        // selectMenu: []//todo 使用该变量失败
        tags: [],//tags集合
        selectTags: '',//tags高亮
    }),
    actions: {
        addMenu(payload) {//添加tags
            if (this.tags.findIndex(item=>item.href === payload.href) === -1) {
                this.tags.push(payload);//去重追加
            }
        },
        delMenu(payload) {//关闭tags
            const index = this.tags.findIndex(item=>item.href === payload);
            this.tags.splice(index,1);
        },
        changSelectedTag(payload) {//点击tags
            this.selectTags = payload;
        },
    }
});